#include "common_includes.h"
#include <string>
#include <map>
#include <sys/types.h>

#ifndef FTPUSER_H
#define FTPUSER_H

AUTH_NS_START

// Forward Declaration of the class.
class FtpGroup;

class FtpUser {

private:
	FtpUser(const FtpUser& rhs);
	FtpUser& operator=(const FtpUser& rhs);

protected:
	std::string m_sUserName;
	uid_t m_sSid;

	typedef std::map<gid_t, std::string> GroupListType;
	typedef GroupListType::const_iterator GroupListTypeIterator;

	GroupListType m_GroupList;
public:
	FtpUser(std::string userName, uid_t sid);
	virtual ~FtpUser();

	/**
	 * @brief Gets the Sid
	 * @return The Sid.
	 */
	const uid_t GetSid() const {
		return this->m_sSid;
	}

	/**
	 * @brief Get the User Name
	 * @return The User Name
	 */
	const std::string& GetUserName() const {
		return this->m_sUserName;
	}

	/**
	 * @brief Is user member of the group?
	 * @param group Group to which membership is questioned
	 * @return true if the user is a member, false otherwise.
	 */
	bool IsUserMemberOfGroup(const FtpGroup* group) const;

	/**
	 * @brief Register Group To User
	 * @param group The group to add the user to.
	 */
	void RegisterGroupToUser(const FtpGroup* group);
};

AUTH_NS_END

#endif // FTPUSER_H
